#include <stdio.h>

int main() {
	int i;
	int m, n;
	int num = 1;
	int a[100][100] = {0};
	scanf("%d %d", &m, &n);
	int top = 0;
	int bottom = m - 1;
	int left = 0;
	int right = n - 1;
	while (top <= bottom && left <= right) {
		for (i = left; i <= right; i++) {
			a[top][i] = num++;
			if (num == m * n + 1)
				break;
		}
		if (num == m * n + 1)
			break;
		top++;
		for (i = top; i <= bottom; i++) {
			a[i][right] = num++;
			if (num == m * n + 1)
				break;
		}
		if (num == m * n + 1)
			break;
		right--;
		for (i = right; i >= left; i--) {
			a[bottom][i] = num++;
			if (num == m * n + 1)
				break;
		}
		if (num == m * n + 1)
			break;
		bottom--;
		for (i = bottom; i >= top; i--) {
			a[i][left] = num++;
			if (num == m * n + 1)
				break;
		}
		if (num == m * n + 1)
			break;
		left++;

	}

	for (int i = 0; i < m; i++ ) {
		for (int j = 0; j < n; j++) {
			printf("%d ", a[i][j]);
		}
		printf("\n");
	}

	return 0;
}